﻿using System;
using UnityEngine.Events;
using UnityEngine.UI;

namespace UniRx
{
	// Token: 0x02000457 RID: 1111
	public static class UnityGraphicExtensions
	{
		// Token: 0x060017A1 RID: 6049 RVA: 0x000648B4 File Offset: 0x00062CB4
		public static IObservable<Unit> DirtyLayoutCallbackAsObservable(this Graphic graphic)
		{
			return Observable.Create<Unit>(delegate(IObserver<Unit> observer)
			{
				UnityAction registerHandler = delegate()
				{
					observer.OnNext(Unit.Default);
				};
				graphic.RegisterDirtyLayoutCallback(registerHandler);
				return Disposable.Create(delegate
				{
					graphic.UnregisterDirtyLayoutCallback(registerHandler);
				});
			});
		}

		// Token: 0x060017A2 RID: 6050 RVA: 0x000648E0 File Offset: 0x00062CE0
		public static IObservable<Unit> DirtyMaterialCallbackAsObservable(this Graphic graphic)
		{
			return Observable.Create<Unit>(delegate(IObserver<Unit> observer)
			{
				UnityAction registerHandler = delegate()
				{
					observer.OnNext(Unit.Default);
				};
				graphic.RegisterDirtyMaterialCallback(registerHandler);
				return Disposable.Create(delegate
				{
					graphic.UnregisterDirtyMaterialCallback(registerHandler);
				});
			});
		}

		// Token: 0x060017A3 RID: 6051 RVA: 0x0006490C File Offset: 0x00062D0C
		public static IObservable<Unit> DirtyVerticesCallbackAsObservable(this Graphic graphic)
		{
			return Observable.Create<Unit>(delegate(IObserver<Unit> observer)
			{
				UnityAction registerHandler = delegate()
				{
					observer.OnNext(Unit.Default);
				};
				graphic.RegisterDirtyVerticesCallback(registerHandler);
				return Disposable.Create(delegate
				{
					graphic.UnregisterDirtyVerticesCallback(registerHandler);
				});
			});
		}
	}
}
